<template>
    <div>
      <home-header :city="city"></home-header>
      <home-swiper :list="swiperList"></home-swiper>
      <home-icons :iconList="iconList"></home-icons>
      <home-recommend></home-recommend>
      <home-weekend></home-weekend>
    </div>
</template>

<script>
  import HomeHeader from "./components/Header"
  import HomeSwiper from "./components/HomeSwiper";
  import HomeIcons from "./components/HomeIcons";
  import HomeRecommend from "./components/HomeRecommend";
  import HomeWeekend from "./components/HomeWeekend";
  import axios from "axios"
    export default {
        name: "home",
      components:{HomeWeekend, HomeRecommend, HomeIcons, HomeSwiper, HomeHeader },
      data(){
          return{
            city:"",
            swiperList: [],
            iconList: []
          }
      },
      methods:{
        getHomeInfo(){
          axios.get('/api/index.json')
            .then(this.getHomeInfoSucc)
        },
        getHomeInfoSucc (res){
         res=res.data
          if(res.ret && res.data){
            const data = res.data
            this.city =data.city
            this.swiperList=data.swiperList
            this.iconList=data.iconList
          }
        }
      },
      mounted(){
          this.getHomeInfo()
      }
    }
</script>

<style scoped>

</style>
